package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.FankuiBean;
import com.lwj.liwanjia.impl.FankuiView;
import com.lwj.liwanjia.model.FankuiModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/11/13.
 */

public class FankuiPresenter {
    private FankuiView fankuiView;
    private FankuiModel fankuiModel;

    public FankuiPresenter(FankuiView fankuiView) {
        this.fankuiView = fankuiView;
        fankuiModel = new FankuiModel();
    }

    public void subFankui(String token, String complain) {
        if (fankuiView != null) {
            fankuiModel.subFankui(token, complain, new Subscriber<FankuiBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    fankuiView.showError((Exception) e);
                }

                @Override
                public void onNext(FankuiBean fankuiBean) {
                    fankuiView.subFankui(fankuiBean);
                }
            });
        }
    }
}
